package com.atguigu.util;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author 晶晶
 * @Date 2023 03 27 17 04
 **/
public class ThreadPoolUtil_lj {
    public static ThreadPoolExecutor threadPoolExecutor;

    public static ThreadPoolExecutor getThreadPoolExecutor() {

        if (threadPoolExecutor == null) {
            synchronized (ThreadPoolExecutor.class) {
                if (threadPoolExecutor == null) {
                    threadPoolExecutor = new ThreadPoolExecutor(4, 20, 5, TimeUnit.MINUTES, new LinkedBlockingDeque<>());

                }
            }
        }

        return threadPoolExecutor;
    }
}
